import 'package:flutter/material.dart';
import 'package:flutter_badged/flutter_badge.dart';
import 'package:flutter_badged/badge_position.dart';


class BadgePage extends StatefulWidget {
   const BadgePage({Key? key}) : super(key: key);

  @override
  _BadgePageState createState() => _BadgePageState();
}

class _BadgePageState extends State<BadgePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text("badge实现小红点提示"),
        actions: [
          IconButton(
            icon: FlutterBadge(
              icon: Icon(Icons.photo_library),
              itemCount: 2,
            ),
            onPressed: () {},
          )
        ],
      ),
      body: Container(),
      bottomNavigationBar: BottomNavigationBar(
        items: [
          BottomNavigationBarItem(
              label: "Home",
              icon: FlutterBadge(
                icon: Icon(Icons.home),
                itemCount: 3,
                borderRadius: 20.0,
              )),
          BottomNavigationBarItem(
              label: "Messages",
              icon: FlutterBadge(
                icon: Icon(Icons.message),
                itemCount: 33,
                badgeColor: Colors.green,
                position: BadgePosition.topLeft(),
                borderRadius: 20.0,
              )),
          BottomNavigationBarItem(
              label: "Favorites",
              icon: FlutterBadge(
                icon: Icon(Icons.favorite_border),
                itemCount: 333,
                badgeColor: Colors.orange,
                hideZeroCount: false,
                borderRadius: 20.0,
              )),
        ],
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}